package com.liz.lizrpccore.beans.proxys.base;

import com.alibaba.fastjson.JSON;
import com.liz.lizrpccore.entity.LizRpcArg;

import java.util.ArrayList;
import java.util.List;

/**
 * @author liangGongWei
 * @description
 * @create 2021-09-22 11:33
 **/

public abstract class BaseProxy {

    protected List<LizRpcArg> generateArgList(Object[] args) {
        List<LizRpcArg> res = new ArrayList<>();
        for (Object arg : args) {
            LizRpcArg lizRpcArg = new LizRpcArg();
            String className = arg.getClass().getName();
            lizRpcArg.setClassName(className);
            lizRpcArg.setObjStr(JSON.toJSONString(arg));
            res.add(lizRpcArg);
        }
        return res;
    }
}
